﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WPF.DataBinding.DataContext
{
    public class Person:INotifyPropertyChanged
    {
        public string Name 
        { 
            get; 
            set; 
        }
        public string Surname 
        { 
            get; 
            set; 
        }
        private int _Age;
        public int Age 
        {
            get { return _Age; }
            set 
            {
                if (value!=_Age)
                {
                    _Age = value;
                    OnPropertyChanged("Age");
                }
            } 
        }

        public event PropertyChangedEventHandler PropertyChanged;

        public void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged!=null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
